home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / tostring.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.8 KB  |  52 lines

  1. <!--- This example shows the use of ToBase64, ToBinary and ToString --->
  2. <html>
  3. <head>
  4. <title>
  5. ToString Example
  6. </title>
  7. </head>
  8.  
  9. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  10. <BODY  bgcolor="#FFFFD5">
  11.  
  12. <h3>ToString Example</h3>
  13.  
  14. <!----------------------------------------------------------------------
  15. Initialize data.
  16. ----------------------------------------------------------------------->
  17. <CFSet charData ="">
  18. <!----------------------------------------------------------------------
  19. Create a string of all ASCII characters (32-255) and concatenate them together.
  20. ----------------------------------------------------------------------->
  21. <CFLoop index="data" from="32" to="255">
  22.     <CFSet ch=chr(data)>
  23.     <CFSet charData=charData & ch>
  24. </CFLoop>
  25. <p>
  26. The following string is the concatenation of all characters (32 to 255) from the ASCII table.<br>
  27. <cfoutput>#charData#</cfoutput>
  28. </p>
  29. <!----------------------------------------------------------------------
  30. Create a Base 64 representation of this string.
  31. ----------------------------------------------------------------------->
  32. <cfset data64=toBase64(#charData#)>
  33. <p>
  34. The following string is the Base 64 representation of the original string.<br>
  35. <cfoutput>#data64#</cfoutput>
  36. </p>
  37. <!----------------------------------------------------------------------
  38. Create a binary representation of Base 64 data.
  39. ----------------------------------------------------------------------->
  40. <cfset dataBinary=toBinary(data64)>
  41.  
  42. <!----------------------------------------------------------------------
  43. Create the string repesentation of the binary data.
  44. ----------------------------------------------------------------------->
  45. <cfset dataString=toString(dataBinary)>
  46. <p>
  47. The following is the string representation of the binary data.<br>
  48. <cfoutput>#dataString#</cfoutput>
  49. </p>
  50. </body>
  51. </html>
  52.